import 'package:flutter/material.dart';
import 'package:jd_shopping/pages/Tabs.dart';
import 'package:jd_shopping/pages/search.dart';
import 'package:jd_shopping/pages/ProductList/ProductList.dart';
import 'package:jd_shopping/pages/searchProductList.dart';
import 'package:jd_shopping/pages/ProductDetaile.dart';
import 'package:jd_shopping/pages/Cart.dart';
import 'package:jd_shopping/pages/Login/loginPage.dart';
import 'package:jd_shopping/pages/Login/reginFirst.dart';
import 'package:jd_shopping/pages/Login/reginSecond.dart';
import 'package:jd_shopping/pages/Login/reginThree.dart';
import 'package:jd_shopping/pages/payPages.dart';
import 'package:jd_shopping/pages/address.dart';
import 'package:jd_shopping/pages/pay/payPage.dart';
import '../pages/Order/order.dart';



//配置路由
final routes={
      '/order':(context) =>Order(),
      '/payPage':(context) => Pay(),
      '/address':(context) => Address(),
      '/pay':(context) => PayPage(),
      '/login':(context) => LoginPage(),
      '/regfirst':(context) => ReisterFirst(),
      '/regsecond':(context) => ReginSecond(),
      '/regthree':(context) => ReginThree(),
      '/':(context) => Tabs(),
      '/search':(context) => Search(),
      '/cart':(context) => Cart(),
      '/productList': (context, {arguments}) => ProductList(arguments: arguments),
      '/searchproductList': (context, {arguments}) => SearchProductList(arguments: arguments),
      '/productdetaile': (context, {arguments}) => ProductDetaile(arguments: arguments),
};
//ignore: strong_mode_top_level_function_literal_block
var onGenerateRoute=(RouteSettings settings) {
      // 统一处理
      final String name = settings.name; 
      final Function pageContentBuilder = routes[name];
      if (pageContentBuilder != null) {
        if (settings.arguments != null) {
          final Route route = MaterialPageRoute(
              builder: (context) =>
                  pageContentBuilder(context, arguments: settings.arguments));
          return route;
        }else{
            final Route route = MaterialPageRoute(
              builder: (context) =>
                  pageContentBuilder(context));
            return route;
        }
      }
};